public class PureHebbianPlasticity extends SynapseFramework implements ISynapse {
    private double eps = .0005 ;
    
    public PureHebbianPlasticity( INeuron pre , INeuron post , double w ) {
        super( pre , post , w ) ;
        String [ ] params = { "eps" , "tauPrime" } ;
        parameterNames = params ;
    }
    
    public String getParam( String name ) {
        if ( name.equals( "eps" ) ) {
            return "" + eps ;
        } else if ( name.equals( "tauPrime" ) ) {
            return "" + tauPrime ;
        } else {
            return null ;
        }
    }
    
    public String getName( ) {
        return "Pure Hebbian Plasticity" ;
    }
    
    public void setParam( String name , String data ) {
        double value ;
        
        // all parameters are doubles
        try {
            value = Double.parseDouble( data ) ;
        } catch ( NumberFormatException e ) {
            // not a double; ignore the set request
            return ;
        }
        if ( name.equals( "eps" ) ) {
            eps = value ;
        } else if ( name.equals( "tauPrime" ) ) {
            tauPrime = value ;
        }
    }
    
    public ISynapse clone( INeuron pre , INeuron post , double s ) {
        PureHebbianPlasticity syn = new PureHebbianPlasticity( pre , post , s ) ;
        syn.setParam( getParams( ) ) ;
        return syn ;
    }
    
    public void advance( ) {
        int t ;
        t = pre.getTime( ) ;
        w += eps * pre.getPotential( ) * post.getPotential( t - tauPrime ) ;
    }
}
